using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace Util
{
	public class FileStreamEx : MemoryStreamEx
	{
		public FileStreamEx(string name)
		{
			using (TextReader tr = new StreamReader(name, true))
			{
				_data = new List<char>();
				while (true)
				{
					int tmp = tr.Read();
					if (tmp == -1)
						break;
					_data.Add((char)tmp);
				}
			}
		}

		public void Save(string name)
		{
			using (TextWriter wr = new StreamWriter(name, false))
			{
				foreach (char ch in _data)
				{
					wr.Write(ch);
				}
			}
		}
	}
}
